import api from './index'
import { axios } from '@/utils/request'

// pmsGoodsUrl: '/pms-api/pms/pmsGoods/'

/**
 * 路由
 * // pms
    {
        path: '/pms',
        name: 'pms',
        component: PageView,
        redirect: '/pms/pmsGoods',
        meta: { title: '商品信息', icon: 'table', permission: [ 'pms' ] },
        children: [
          {
            path: '/pms/pmsGoods',
            name: 'PmsGoods',
            component: () => import('@/views/pms/PmsGoodsList'),
            meta: { title: '商品信息', keepAlive: true, permission: [ 'pms_pmsGoods' ] }
          }
        ]
      },
 */

/**
 * 查询列表
 * @returns {*}
 */
export function getList (parameter) {
    return axios({
        url: api.pmsGoodsUrl,
        method: 'get',
        data: parameter
    })
}

/**
 * 查询详情
 * @param id
 * @returns {*}
 */
export function getPmsGoods (id) {
    return axios({
        url: api.pmsGoodsUrl + id,
        method: 'get'
    })
}

/**
 * 更新
 * @param id
 * @param parameter
 * @returns {*}
 */
export function updatePmsGoods (id, parameter) {
    return axios({
        url: api.pmsGoodsUrl + id,
        method: 'post',
        data: parameter
    })
}

/**
 * 新增
 * @param parameter
 * @returns {*}
 */
export function addPmsGoods (parameter) {
    return axios({
        url: api.pmsGoodsUrl,
        method: 'put',
        data: parameter
    })
}

/**
 * 删除
 * @param id
 * @returns {*}
 */
export function deletePmsGoods (id) {
    return axios({
        url: api.pmsGoodsUrl + id,
        method: 'delete'
    })
}

/**
 * 批量删除
 * @param id
 * @returns {*}
 */
export function batchDeletePmsGoods (parameter) {
    return axios({
        url: api.pmsGoodsUrl + 'delete/batch',
        method: 'post',
        data: parameter
    })
}
